package com.hyopt.common.push.Notification;

import cn.hutool.core.util.ObjectUtil;
import com.hyopt.common.push.config.UmConfig;
import com.hyopt.common.push.util.UmPushUtil;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;

import java.util.Map;


@Slf4j
@Data
public class UmAndriodNotification extends UmNotification{

    public UmAndriodNotification(String type, Map params){
        super(type,params);
        this.setSys(UmConfig.Sys.Android.name());
        this.setAppMasterSecret(UmConfig.AppMasterSecret);
        this.getParams().put("appkey",UmConfig.AppKey);
        UmPushUtil.setAndriodBody(this.getParams());
        //必填参数验证
        this.setBody(this.getParams());
    }

    public void setDisplayType(String displayType){
        Map content=this.getBody();
        UmPushUtil.setAndriodKeyValue(content,"display_type",displayType);
    }

    public void setKeyValue(String key,Object value){
        Map content=this.getBody();
        UmPushUtil.setAndriodKeyValue(content,key,value);
    }

    public void setTicker(String ticker){
        this.setKeyValue("ticker", ticker);
    }
    public void setText(String text) {
        this.setKeyValue("text", text);
    }

}
